package com.aoxin.service.impl.course.webCourse;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;

import com.aoxin.mapper.SlfArticleMapper;
import com.aoxin.model.SlfArticle;
import com.aoxin.service.inter.course.webCourse.ArticleService;
import com.aoxin.util.ErrorUtil;
@Service
public class ArticleServiceImpl implements ArticleService{
    @Autowired
    private SlfArticleMapper slfArticleMapper;

    @Override
    @Transactional
    public Integer deleteSlfArticle(List<Integer> articleId) {
        Assert.notNull(articleId,String.format(ErrorUtil.SLFACTIVITY,"articleId"));
        Integer integer=0;
        if(articleId !=null){
            integer=slfArticleMapper.deleteSlfArticle(articleId);
        }
        return integer;
    }

    @Override
    @Transactional
    public Integer insertSlfArticle(SlfArticle slfArticle) {
        Assert.notNull(slfArticle,String.format(ErrorUtil.SLFACTIVITYRULE,"slfArticle"));
        Integer integer=0;
        if(slfArticle !=null){
            integer= slfArticleMapper.insertSlfArticle(slfArticle);
        }
        return integer;
    }

    @Override
    public List<SlfArticle> getSlfArticle(SlfArticle slfArticle) {
        Assert.notNull(slfArticle,String.format(ErrorUtil.SLFACTIVITY,"slfArticle"));
        List<SlfArticle> list=null;
        if (slfArticle != null) {
           list = slfArticleMapper.getSlfArticle(slfArticle);
        }
        return list;
    }

    @Override
    @Transactional
    public Integer updateSlfArticle(SlfArticle slfArticle) {
        Assert.notNull(slfArticle,String.format(ErrorUtil.SLFACTIVITY,"slfArticle"));
        Integer integer=0;
        if (slfArticle !=null){
            integer=slfArticleMapper.updateSlfArticle(slfArticle);
        }
        return integer;
    }

    @Override
    public List<SlfArticle> DisplayType(SlfArticle slfArticle) {
        Assert.notNull(slfArticle,String.format(ErrorUtil.SLFACTIVITY,"slfArticle"));
        List<SlfArticle> list = slfArticleMapper.getSlfArticle(slfArticle);
        return list;
    }

    @Override
    public List<SlfArticle> getBySlfArticle(SlfArticle slfArticle) {
		List<SlfArticle> list = slfArticleMapper.getBySlfArticle(slfArticle);
        return list;
    }
}
